/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.tramite.be.Certificado;

/**
 *
 * @author christian
 */
public class CertificadoDelegate {
    private CertificadoFacadeLocal local;

    public CertificadoDelegate() {
        local=lookupCertificadoFacade();
    }

    public void create(Certificado certificado) {
        local.create(certificado);
    }

    public void edit(Certificado cert){
        local.edit(cert);
    }

    public Certificado buscar(Long cod){
        return local.find(cod);
    }

    private CertificadoFacadeLocal lookupCertificadoFacade() {
        try {
            Context c = new InitialContext();
            return (CertificadoFacadeLocal) c.lookup("java:comp/env/CertificadoFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

}
